// pages/my/vip/vip_invitation/component/vip_invitation_letter/vip_invitation_letter.js

Component({
  options: {
    /** 启用多slot支持 */
    multipleSlots: true
  },
  /**
   * 组件的属性列表
   */
  properties: {
    userMsg: Object,
    invitationInfo: Object,
  },

  /**
   * 组件的初始数据
   */
  data: {},
  /**
   * 组件的方法列表
   */
  methods: {

    //打开地址
    openAddress(e) {
      var lng = this.data.invitationInfo.shop.lng || '';
      var lat = this.data.invitationInfo.shop.lat || '';
      wx.openLocation({
        //当前经纬度
        latitude: Number(lat),
        longitude: Number(lng),
        //缩放级别默认28
        scale: 28,
      })
    },
    //打电话
    calling() {
      let phone = this.data.invitationInfo.shop.mobile
      wx.makePhoneCall({
        phoneNumber: phone,
        success: function () {
          console.log("拨打电话成功！")
        },
        fail: function () {
          console.log("拨打电话失败！")
        }
      })
    },
    // 去往店铺首页
    toShopIndex(){
      console.log(wx.getStorageSync('shopId'),wx.getStorageSync('usertoken'));
      wx.requestSubscribeMessage({
        tmplIds:["G1hVNhiSiVctKD70HChIfA_z8cNprccBEjgKRCswY3Y","VahXCIaUZHNHyIIP6LYakcmroqlbOe8Q-qlMLJ5-Pps"],
        complete(){
          wx.reLaunch({
            url: '/pages/Index/Index',
          })
        }
      })
      
    }
  }
})